import 'package:get/get.dart';

import '../../../models/focus_model.dart';
import '../../../units/httpsClient.dart';

class HomeController extends GetxController {
  RxList<FocusItemModel> swiperList = <FocusItemModel>[].obs;
  
  HttpsClient httpsClient = new HttpsClient();

  @override
  void onInit() {
    getFocusData();
  }

  //获取轮播图数据
  getFocusData() async {
    var response = await httpsClient.get("api/focus");
    if (response != null) {
      print(response);
      var focus = FocusModel.fromJson(response.data);
      swiperList.value = focus.result!;
      update();
    }
  }
}
